﻿using System.Collections.Generic;

namespace StoryCardLogic
{
    public class StoryManager : IStoryManager
    {
        private List<Story> _stories;
        public List<Story> Stories
        {
            get { return _stories ?? (_stories = new List<Story>()); }
            set { _stories = value; }
        }

        public void AddStory(string storyText)
        {
            var trimmedStory = storyText.Trim();
            if (trimmedStory.Length == 0)
                return;
            Stories.Add(new Story(trimmedStory));
        }

        public void AddStory(Story story)
        {
            if (story == null) return;
            AddStory(story.Text);
        }

        public void AddStories(StoryManager manager2)
        {
            foreach (var story in manager2.Stories)
                AddStory(story);
        }
    }
}